package com.calvin.combat.view;

import android.app.Activity;
import android.app.LauncherActivity;
import android.content.Intent;
import android.nfc.Tag;
import android.os.Bundle;
import android.util.Log;
import android.view.Menu;
import android.view.MenuItem;

import com.calvin.combat.MainActivity;
import com.calvin.combat.util.ActivityCollection;
import com.calvin.combat.util.Config;

public abstract class BaseActivity extends Activity {
	private String TAG = "BaseActivity";

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		Log.d(TAG, getClass().getSimpleName());
		ActivityCollection.addActivity(this);
		String token = Config.getToken(this);
		if (token != null) {
			Intent intent = new Intent(this, MainActivity.class);
			intent.putExtra(Config.KEY_TOKEN, token);
			startActivity(intent);
		} else {
			// startActivity(new Intent(this,MainActivity.class));
		}
	}

	@Override
	public boolean onCreateOptionsMenu(Menu menu) {
		return super.onCreateOptionsMenu(menu);
	}

	@Override
	public boolean onOptionsItemSelected(MenuItem item) {
		return super.onOptionsItemSelected(item);
	}

	@Override
	protected void onDestroy() {
		super.onDestroy();
		ActivityCollection.removeActivity(this);
	}

}
